#!/bin/sh
#
# $OpenBSD: isc_named.rc,v 1.3 2014/08/22 20:32:13 sthen Exp $

daemon="${TRUEPREFIX}/sbin/named"
daemon_flags="-t ${LOCALSTATEDIR}/named -u _bind -U 4"

. /etc/rc.d/rc.subr

rc_pre() {
	if ! cmp -s ${SYSCONFDIR}/rndc.key ${LOCALSTATEDIR}/named/etc/rndc.key ; then
		if ${TRUEPREFIX}/sbin/rndc-confgen -a -t ${LOCALSTATEDIR}/named \
		    >/dev/null 2>&1; then
			chmod 0640 ${LOCALSTATEDIR}/named/etc/rndc.key \
			    >/dev/null 2>&1
		fi
	fi
}

rc_cmd $1
